import Http from "../utils/http";
import Token from "./token"
import cache from "../enum/cache";



 class User{
    static getUserInfoByLocal(){
        return wx.getStorageSync(cache.USERINFO)
    }


    static async login() {
        const res = await Token.getToken()
        wx.setStorageSync(cache.TOKEN, res);
    }


    static async updateUserInfo(data){
        const res = await Http.request({
            url: '/v1/user',
            method: 'PUT',
            data
        })
        
        wx.setStorageSync(cache.USERINFO, res)
    }
}

export default User